// 获取元素
let list = document.getElementById("mz-nav");
let menuBox = document.getElementById("mz-menu");
let menu = document.querySelectorAll(".mz-menu>ul,.mz-menu>div");

// 移到对应的li，对应的下拉menu出现
list.onmouseover = function(e){
  if (e.target.tagName.toLowerCase() === "a") {
    menu.forEach((item,index)=>{
      if(index<5){
        item.className="card-group text-center d-flex justify-content-center";
      }else{
        item.className="container-fluid px-0 mz-app-drop";
      }
    })
    let listt = e.target.getAttribute("data-t");
    if (listt) {
      let currentMenu = document.querySelector(`.mz-menu>ul[data-t=${listt}]`);
      let currentApp = document.querySelector(`.mz-menu>div[data-t=${listt}]`);
      console.log(currentMenu);
      console.log(currentApp);
      if (currentMenu) {
        currentMenu.className += " current";
      }else if (currentApp) {
        currentApp.className += " current";
      }else{
        return;
      }
    };
  }
}
// 移出下拉menu，menu消失
menuBox.onmouseleave = function(){
  menu.forEach((item,index)=>{
    if(index<5){
      item.className="card-group text-center d-flex justify-content-center";
    }else{
      item.className="container-fluid px-0 mz-app-drop";
    }
  })
}